/* Copyright (c) 2006 YourNameHere
   See the file LICENSE.txt for licensing information. */
var n = 1;
search: while (true) {
  n += 1;
  for (var i = 2; i <= Math.sqrt(n); i += 1) if (n % i == 0) continue search;
  // found a prime!
  postMessage(n);
}